package com.excerise.arr;

/**
 *
 *
 * @author Way on 2021/7/25
 */
public class BubbleSort {

    public static void main(String[] args) {
        int[] arr = {33, 67, 12, 90, 23, 46, 88765, 2345, 1, 34, 7};

        for (int i = 0; i < arr.length - 1; i++) {
            for (int j = 0; j < arr.length - 1 - i; j++) {
                if (arr[j] > arr[j + 1]) {
                    int temp = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = temp;
                }

            }
            System.out.println("\n第" + (i + 1) + "轮排序结果");
            for (int j = 0; j < arr.length; j++) {
                System.out.print(arr[j] + "\t");
            }
        }
    }
}
